home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / com / bbs / server / hellbbs / docs / scripts.hlp < prev    next >
Encoding:
Text File  |  1996-05-12  |  8.9 KB  |  309 lines

  1.                         HELL'S BBS SCRIPT LANGUAGE
  2.  
  3. CONTENT:
  4.  
  5. 1) INTRODUCTION
  6. 2) COMMANDS
  7. 3) FUNCTIONS
  8. 4) EXAMPLES
  9. 5) PREDEFINED VARS
  10. 6) EBNF
  11.  
  12.  
  13.  
  14.  
  15. --------------------------------------------------------------------------
  16. 1)
  17. INTRODUCTION:
  18. -------------
  19.  
  20. For all freaks: There is some kind of EBNF at the end of this file...
  21.  
  22. Attention: This script-language is just intended to allow people to make
  23. some additional BBS functions. It is VERY slow, due to the fact it was
  24. written 100% in GfA-basic. But on the other side, it offers some stuff
  25. you have NEVER seen in any other programming language.
  26.  
  27. 1. No difference between numbers and strings. -> Calculate with strings!
  28. 2. You can CALCULATE a string. The string may even contain script-vars!!
  29. 3. Commands to to handle all modem in/output, files/mail/boards...
  30.  
  31. Possible examples for scripts:
  32.  
  33. - Alternative connect-sequence to detect fax/voice
  34. - Make list of best up/downloaders
  35. - vote about something
  36. - setup of different user classes with level/quota/areas...
  37. - little games..
  38. - Much more... just use your imagination...
  39.  
  40. --------------------------------------------------------------------------
  41. 2)
  42. COMMANDS:
  43. ---------
  44.  
  45. Syntax: COMMAND [var] [,var]
  46.  
  47.  
  48. SET varname,var        [Puts anything into varname
  49. varname=var        [Is exactly the same as SET
  50. set var,"text"        [Put "text" into var. I prefer var="text"
  51. var="anytext"        [Content of var is a text ("anytext")
  52. var="x^2+y^2"        [Content of var is an expression (same as text)
  53. var=x^2+y^2        [Content of var is the result of the expression
  54.  
  55. PRINT var [,var]     [Displays data to the screen, with [cr][lf] at end
  56. SEND var [,var]      [Displays data to the screen.
  57. PRINT "Your level: ",l  [Example. Output: Your level: 0
  58.  
  59.  
  60. INPUT var,varname[,var] [Read string from user. [,maxlength] default 60
  61. INPUT "Your age: ",a,2    [Read input with max. lenth 2 and put result in a
  62.  
  63. IF (expression) AND|OR (expression)   [Conditional branch
  64. ELSE
  65. ENDIF
  66. IF (a*2<b*3) AND (c=3)    [Example
  67.             [ Go here, if true
  68. ELSE
  69.             [ Go here if false...
  70. ENDIF
  71.  
  72. REPEAT            [Repeat commands until expression is true
  73. UNTIL expression
  74.  
  75. WHILE expression    [Repeat commands AS LONG as expression true is
  76. WEND
  77.  
  78. DO            [Endless loop. EXIT or EXIF statement NEEDED!
  79. LOOP
  80.  
  81. EXIT            [Leaves a structure immediately. (ALSO IF/ENDIF!)
  82. EXIF expression        [Leaves a structure if expression is true
  83.  
  84. CALC var,varname    [Calculates an expression->result in varname
  85. CALC "a*2/b",res    [Example, put result of a*2/b into res
  86.  
  87. CURSORPOS var,var    [Positionates the graphics-cursor at var,var=x,y
  88.  
  89. SAVECURSOR        [Saves position of the cursor
  90. RESTORECURSOR        [Restores the saved position of the cursor
  91.  
  92. TEXTCOLOR var        [Sets the color of the text (0-7)
  93. BACKCOLOR var        [Sets the color of the background (0-7)
  94. TEXTSTATUS var        [Sets the type of text. (0-7)
  95.  
  96. USERFIND var,varname    [Finds the number of a user -> result in varname
  97. USERFIND "NAME",number  [Example
  98.  
  99. GETUSER1 var [,var]    [Gets name and [number] of the first user
  100. GETNUSER var [,var]    [Gets name and [number] of the next user
  101.  
  102. USERGET var,var,varname [Gets any entry in the user-file
  103. USERGET "SYSOP","LEVEL",lev    [Example... Reads the entry "LEVEL"
  104.  [from the user-file of SYSOP and puts it into lev. You can use the
  105.  [user-number instead of the name to speed up the operation.
  106.  
  107. USERSET var,var,var     [Same as USERGET, but SETS the entry!
  108.  
  109. FILEPRINT var        [Prints the (ansi) file var to the screen
  110. %var            [Same, for use in MENUS.BBS file...
  111.  
  112. FILEPAGE var        [Displays a text-file var in pages!
  113. $var            [Same, for use in MENUS.BBS
  114.  
  115. PATH var        [Sets the file-path var
  116. >var            [Same, for use in MENUS.BBS
  117.  
  118. INC varname        [Increments var by 1
  119. DEC varname        [Decrements var by 1
  120.  
  121. COMMAND var [,var]    [Executes internal functions, defined by numbers
  122.             [See MENUS.BBS for examples
  123.  
  124. INTERNAL var        [Executes a command-line like in MENUS.BBS
  125.             
  126. LOGIN            [Executes the login routine. Only for LOGIN.SCR
  127.  
  128. PAUSE var        [Simply pauses var/50 seconds.
  129.  
  130. SCAN varname        [Scans keyboard for input [ max 1 char in var
  131. LOCALSCAN varname    [Scan ONLY local keyboard at BBS! max 1 char
  132. REMOTESCAN varname    [Scan ONLY remote keyboard! max 1000 chars!!
  133.  
  134. CODE var,varname    [Encodes a password var [ result in varname
  135.  
  136. CLS            [Clears the screen
  137.  
  138. MAIL var,var,var[,var]  [Send a private mail
  139. MAIL "from","to","text","subject"  [Example
  140.  
  141. EXEC var,var,var    [Execute a TOS binary program
  142. EXEC "file","com","env" [Example
  143.  
  144. WRITEFILE var,varname    [Put the content of varname into file var
  145. WRITEFILE "file",data   [Example
  146. READFILE var,varname    [Read file var into varname
  147. READFILE "file",var    [Example
  148.  
  149. MIDSET varname,var,var  [Puts string into var at special position
  150. MIDSET a,pos,"anything" [Example
  151.  
  152. KILLBUFF        [Erases the input-buffer
  153.  
  154. UNIXMAIL var        [Includes a unix mail-file, also newsgroups!
  155.  
  156. KILL var        [Erases a file
  157.  
  158. TERMINATE        [The BBS program just terminates!!
  159. REBOOT            [Makes the computer reboot! (reset)
  160.  
  161. HANGUP            [Breaks the line and updates the user
  162.  
  163. UPDATEUSER        [Updates all informations of the actual user
  164.  
  165. ECHO ON|OFF|HIDDEN    [Change input display normal/none/as stars
  166.  
  167. LOCALECHO ON|OFF|ONLY    [Change local echo of BBS
  168.  
  169. CARRCHECK ON|OFF    [Toggle general carrier-check
  170.  
  171. --------------------------------------------------------------------------
  172. 3)
  173. FUNCTIONS:
  174. ----------
  175.  
  176. A function always returns a value, so put it in a var: ret=FUNCTION(var)
  177.  
  178. DECIDE(var)        [Execute question in TEXTS.BBS (number var)
  179. CALC(var)        [Calculate any expression, even vars in strings!
  180. UPPER(var)        [Upper cases of any text
  181. LEFT(var,var)        [Left part of var LEFT(var,len)
  182. RIGHT(var,var)        [Right part of var LEFT(var,len)
  183. MID(var,var,var)    [Special part of var MID(var,start,len)
  184. JOIN(var,var [,var])    [Join different vars, treat them as strings!
  185. TEXT(var)        [Return text defined in TEXTS.BBS (number var)
  186. CHR(var)        [Return char of ASCII value
  187. ASC(var)        [Return ASCII valueof first char
  188. LEN(var)        [Return lenght of var
  189. SPACE(var)        [Return a space-string of lenght var
  190. STRING(var,var)        [STRING(len,char) string of char with lenght len
  191. RANDOM(var)        [Return random number between 0 and var-1
  192. EXIST(var)        [Check existence of file. -1=exists 0=not found
  193. SIN(var) COS(var) TAN(var) SQR(var) ....    [Various math. functions
  194.  
  195. --------------------------------------------------------------------------
  196. 4)
  197. EXAMPLES:
  198. ---------
  199.  
  200. 4.1) Maths
  201. ----------
  202.  
  203. input "enter a function f(x,y) a.e sqr(x^2+y^2): ",func,20
  204. input "enter x: ",x
  205. input "enter y: ",y
  206. print "Result: ",calc(func)
  207.  
  208. 4.2) Example login script
  209. -------------------------
  210.  
  211. fileprint "login.ans"
  212.  
  213. print
  214. print "News: blablabla"
  215.  
  216. login            [Execute login routine!
  217.  
  218. mfile="lanliker"
  219.  
  220. path infopath
  221. if exist(mfile)=-1
  222.  unixmail mfile     [Include unix-mailfile if present
  223.  kill mfile        [Erase it then....
  224. endif
  225.  
  226. command 1        [ check for new mail... (System-command number 1)
  227.  
  228. 4.3) An example terminal
  229. ------------------------
  230.  
  231. cls
  232. localecho only            [Do not send to modem
  233. print "Just type ### to quit"
  234. carrcheck off                   [Send without carrier-check
  235. rb="   "
  236. do
  237.     localscan lk        [Scan local keyboard
  238.     if lk<>""        [If input present
  239.         localecho off    [Send to modem, but not to screen!
  240.         send lk        
  241.         localecho only
  242.         rb=lk+left(rb,2) [Check for escape sequence...
  243.     endif
  244.     exif rb="###"        [Leave after escape sequence
  245.     do
  246.         remotescan rk    [Try to read data from the modem
  247.         exif rk=""    [as long we can...
  248.         send rk        [print to screen (localecho only)
  249.     loop
  250. loop
  251. localecho on
  252. carrcheck on
  253.  
  254. --------------------------------------------------------------------------
  255. 5)
  256. PREDEFINED VARS:
  257. ----------------
  258.  
  259. Some vars you can read, but should not set:
  260. This list is not complete, additional vars will follow...
  261.  
  262. LASTDATE    ->Date of previous login of user
  263. LASTTIME    ->Time on LASTDATE of previous login of user
  264. ACALL        ->Number of calls from user
  265. USER        ->Name of actual user
  266. TIME        ->Actual time
  267. DATE        ->Actual date
  268. TIMER        ->200Hz timer
  269. MAINPATH    ->Path of actual language-folder
  270. INFOPATH    ->Path of start-system-files
  271. HELLDRIVE    ->Driver where all BBS-system-data is
  272. CARRIER        ->If carrier is present: 1 else 0
  273.  
  274.  
  275. --------------------------------------------------------------------------
  276. 6)
  277. EBNF:
  278. -----
  279.  
  280. SOME KIND OF EBNF FOR THE PEOPLE WHO NEED IT (OR THINK THEY NEED IT) :
  281. If you find any mistake in this EBNF, be proud and go drink a beer!
  282.  
  283. COMMAND [var] [,var]
  284.                               
  285. var          : varname | string
  286.  
  287. string       : ( text | expression | function ) [ + string]
  288.  
  289. expression   : factor ["/" | "*" factor]
  290.  
  291. factor         : ( number ["-" | "+" number] ) | "("expression")"
  292.  
  293. number       : realnumber | var | function | string
  294.  
  295. function     : functionname"("var [,var]")"
  296.  
  297. realnumber   : inumber ["." inumber]
  298.  
  299. inumber      : snumber [snumber]
  300.  
  301. snumber      : "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
  302.  
  303. text         : "ANY_CHAR_YOU_CAN_TYPE" [text]                
  304.  
  305. varname      : text [inumber] ["("expression")"]
  306. functionname : text
  307.  
  308. --------------------------------------------------------------------------
  309.